<template>
  <div class="hello">
    <h1>我是减法组件---{{age}} ---{{myAge}}</h1>
    <button @click="sub">- 1</button>
    <button @click="subN(8)">- n</button>
    <button @click="subAsync">async - 1</button>
    <button @click="subNAsync(20)">async - n</button>
  </div>
</template>

<script>
import {mapState, mapMutations, mapActions, mapGetters} from 'vuex'
export default {
  data() {
    return {
    }
  },
  methods: {
    ...mapMutations(['sub', 'subN']),
    ...mapActions(['subAsync', 'subNAsync']),
    // subOne() {
    //   this.sub()
    // },
    // subNum() {
    //   this.subN(8)
    // },
    // subOneAsync() {
    //   this.subAsync()
    // },
    // subNumAsync() {
    //   this.subNAsync(10)
    // },
  },
  computed: {
    ...mapState(['age']),
    ...mapGetters(['myAge'])
  }
}
</script>

<style scoped>

</style>
